
#include <boost/test/unit_test.hpp>


#define _DEBUGING
#include "../Handle.h"
#include "../Handles.h"




class FixtureHandles
{
public:


    FixtureHandles()
    {

    }

};


BOOST_FIXTURE_TEST_CASE( TestHandles_1, FixtureHandles )
{
    static const int handlesTableSize=300;

    Handles<Handle<int>,int,handlesTableSize> handles;

    for(int i=0;i<100;i++)
    {
        Handle<int> arrayHandles[handlesTableSize];
        
        for(int j=0;j<handlesTableSize;j++)
        {
            arrayHandles[j]=handles.acquire();
        }

        for(int j=0;j<handlesTableSize;j++)
        {
            *(handles.dereference(arrayHandles[j]))=j;
        }

        for(int j=0;j<handlesTableSize;j++)
        {
            BOOST_CHECK(*(handles.dereference(arrayHandles[j]))==j);
        }

        for(int j=0;j<handlesTableSize;j++)
        {
            handles.release(arrayHandles[j]);
        }

    }


}

